<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <form class="form-inline" action="" method="get">
        <div class="form-group">
            <label for="title">标题</label>
            <input type="text" name="title" value="{$title?$title:''}" class="form-control" id="title" placeholder="文章标题">
        </div>
        <button type="submit" class="btn btn-default">搜索</button>
    </form>
</div>
<div class="wrap">
    <table class="table">
        <thead>
        <tr>
            <th>id</th>
            <th>文章标题</th>
            <th>创建时间</th>
            <th>更新时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <foreach name="list" item="vo">
            <tr>
                <td>{$vo.id}</td>
                <td>{$vo.title}</td>
                <td>{:date('Y-m-d',$vo.create_time)}</td>
                <td>{:date('Y-m-d',$vo.update_time)}</td>
                <th>
                    <a href="{:url('admin/article/edit',['id'=>$vo.id])}">编辑</a>
                    <a href="{:url('admin/article/view',['id'=>$vo.id])}">查看</a>
                    <a class="delete-btn" data-id="{$vo.id}" href="#" data-toggle="modal" data-target="#modalDelete" >删除</a>
                </th>
            </tr>
        </foreach>
        </tbody>
    </table>
    <div class="pagination">{$page|default=''}</div>

</div>
<div class="modal fade" tabindex="-1" role="dialog" id="modalDelete" aria-labelledby="mySmallModalLabel">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="gridSystemModalLabel">是否确定删除</h4>
            </div>
            <div class="modal-body">
                是否确定删除该文章？
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" id="delSubmit" data-id="">非常确定</button>
            </div>
        </div>
    </div>

</div>
<script language="JavaScript" type="application/javascript">
    $(function(){
        $('.delete-btn').click(function(){
            var id = $(this).attr('data-id');
            $('#delSubmit').attr('data-id',id);
        });
        $('#delSubmit').click(function(){
            var id = $(this).attr('data-id');
            location.href = '/admin/article/delete/id/'+id;
        })
    });
</script>
</body>
</html>